package com.zy.socket.chat2;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/19 16:24
 **/
public class Server {
    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(12345);
            System.out.println("在" + 12345 + "端口启动监听成功！");

            while(true){
                Socket accept = serverSocket.accept();
                MyServerThread ct = new MyServerThread(accept);
                ct.start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
